<!--
 * @Author: yushuang
 * @Date: 2024-12-19 11:16:35
 * @LastEditors: yushuang
 * @LastEditTime: 2024-12-19 15:55:47
 * @Description: 
-->
<script setup lang="ts">
import { watchEffect } from 'vue';
import { message, Modal, notification, theme } from 'ant-design-vue';
import { registerTokenToCSSVar } from './token-to-cssvar';
import { useAntdToken } from '@/composables/antd-token';
import { useSetGlobalConfig } from '@/composables/global-config';

defineOptions({
  name: 'TokenProvider'
});
const { token } = theme.useToken();
const { setToken } = useAntdToken();
const [modal] = Modal.useModal();

useSetGlobalConfig({
  message,
  modal,
  notification
} as any);
watchEffect(() => {
  setToken(token.value);
  registerTokenToCSSVar(token.value);
});
</script>

<template>
  <slot />
</template>
